package cn.jobstart.controller;
import cn.jobstart.es.service.IResumeEsService;
import cn.jobstart.web.common.SkJsonResult;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.springframework.web.bind.annotation.RestController;
import cn.jobstart.pubInter.exception.SkException;
import cn.jobstart.pubInter.IBaseService;
import cn.jobstart.pubInter.RestfulController;
import cn.jobstart.dto.ResumeProjectExperienceDTO;
import cn.jobstart.dto.ResumeProjectExperiencePageDTO;
import cn.jobstart.modelExt.ResumeProjectExperienceExt;
import cn.jobstart.searchExt.ResumeProjectExperienceSearchExt;
import cn.jobstart.service.IResumeProjectExperienceService;
import cn.jobstart.vo.ResumeProjectExperienceDetailVO;
import cn.jobstart.vo.ResumeProjectExperienceListVO;
import cn.jobstart.vo.ResumeProjectExperienceDomainVO;
import cn.jobstart.vo.ResumeProjectExperienceDetailDomainVO;
import cn.jobstart.export.ResumeProjectExperienceDomainExport;
import cn.jobstart.controller.ApiManageController;
import org.springframework.validation.annotation.Validated;
import java.util.Set;
import java.util.HashSet;
import cn.jobstart.pubInter.exception.BusinessException;

/**
*    @author sunke
*    @Date 2023-09-06 15:00:21
*    @description ResumeProjectExperienceController      项目经历
*/
@Api(tags = "人才管理系统-项目经历相关", description = "项目经历相关接口")
@RestController(value ="resumeProjectExperienceRestfulController")
@RequestMapping("/resumeProjectExperience/")
@Validated
public class ResumeProjectExperienceController extends ApiManageController<ResumeProjectExperienceDTO,ResumeProjectExperiencePageDTO,ResumeProjectExperienceExt, ResumeProjectExperienceSearchExt,ResumeProjectExperienceDomainVO,ResumeProjectExperienceDetailDomainVO,ResumeProjectExperienceDetailVO,ResumeProjectExperienceListVO,String> {

	@Resource(name = "resumeProjectExperienceService")
	private IResumeProjectExperienceService resumeProjectExperienceService;


	@Resource
	private IResumeEsService resumeEsService;

	@Override
	public void afterPostMod(ResumeProjectExperienceDTO dto, ResumeProjectExperienceExt domain, SkJsonResult<ResumeProjectExperienceDetailVO> jsonResult, HttpServletRequest request, HttpSession session) throws SkException {
		super.afterPostMod(dto, domain, jsonResult, request, session);
		resumeEsService.publishResumeProjectExperienceByResumeId(domain.getResumesId());
	}

	@Override
	public void afterPostAdd(ResumeProjectExperienceDTO dto, ResumeProjectExperienceExt domain, ResumeProjectExperienceDetailVO resumeProjectExperienceDetailVO, HttpServletRequest request, HttpSession session) throws SkException {
		super.afterPostAdd(dto, domain, resumeProjectExperienceDetailVO, request, session);
		resumeEsService.publishResumeProjectExperienceByResumeId(domain.getResumesId());

	}

	@Override
	public IBaseService<ResumeProjectExperienceExt, ResumeProjectExperienceSearchExt,String> getBaseService() throws SkException {
		return resumeProjectExperienceService;
	}

	@Override
	public String getBaseRoute() {
		return "/resumeProjectExperience/";
	}

	/**
	* 当前模板名称
	* @return
	*/
	@Override
	public String getModelName(){
		return "项目经历";
	}

	@Override
	public Class exportExcelClass() {
		return ResumeProjectExperienceDomainExport.class;
	}

	@Override
	public Set<String> totalMapSet() {
		Set totalMapSet=new HashSet();
		totalMapSet.add("count(resume_project_experience.rpe_id) as countNum");
		return totalMapSet;
	}


}